home *** CD-ROM | disk | FTP | other *** search
- #ifndef CRINKLE
- #define CRINKLE
-
- typedef double Height;
- typedef double Length;
-
- #define START 0
- #define STORE 1
- #define NSTRIP 8
-
- /* -------------------------------------------------------------------- */
- /* strip of altitudes */
- /* -------------------------------------------------------------------- */
-
- typedef struct strip {
- int level;
- Height *d; // should have 2^level + 1 points
- } Strip;
-
- /* -------------------------------------------------------------------- */
- /* parameters for the update */
- /* -------------------------------------------------------------------- */
-
- typedef struct parm {
- Height mean; // mean altitude
- int rg1; // optional regeneration steps
- int rg2;
- int rg3;
- int cross; // use four point average on edges rather than 2
- int force_front; // keep front edge low
- int force_back; // keep back edge low
- Height forceval; // value to force to
- double mix; // fraction of old value to include in average
- double midmix; // same but for cross updates
- double fdim;
- } Parm;
-
- /* -------------------------------------------------------------------- */
- /* The parameter struct for the recursive procedure */
- /* -------------------------------------------------------------------- */
-
- typedef struct fold {
- int level; // levels of recursion below us
- Length scale; // scale factor for perturbations
- Length midscale; // as above but for diagonal offsets
- struct parm *p; // update parameters
- struct strip *s[NSTRIP]; // pointers to the pipeline strips
- struct strip *save; // save position for STORE state
- int stop; // level to stop recursion
- int state; // internal stat of algorithm
- struct fold *next; // next iteration down
- } Fold;
-
- Strip *next_strip( Fold * );
- Fold *make_fold( Parm *, int, int, Length );
- void free_fold( Fold * );
- Length gaussian ( void );
- #endif
-